<div class="cont">
    <div class="position " id="page_title">
        <img alt="位置图标" src="dist/images/position.png"/>系统管理&gt;权限管理
        <a ng-click="openDetail()" ng-hide="$needClientCache" title="打开新窗口查看"><i class="large External icon"></i>
        </a>
    </div>
    <div class="mybackground" style="overflow:hidden;">
        <div class="cont_fr_top">
            <div class="menus_top">
                <div class="menus_l">权限管理</div>
                <div class="cont_fr_btn">
                    <div class="fr">
                        <button class="cont_f_btn3" ng-click="showAdd()" >增加权限</button>
                    </div>
                </div>
            </div>
        </div>
    </div>
	<div class="menus">
         <div class="menus_table">
            <table class="ui celled yellow striped table">
                <thead>
                    <tr>
                        <th>权限名称</th>
                        <th>权限代码</th>
                        <th>创建时间</th>
                        <th>备注</th>
                        <th>编辑</th>
                    </tr>
                </thead>
                <tbody>
                    <tr ng-repeat="vright in rightlist">
                        <td>{{vright.right_name}}</td>
                        <td>{{vright.code}}</td>
                        <td>{{vright.create_time}}</td>
                        <td>{{vright.info}}</td>
                        <td>
                            <a href="javascript:;"  ng-click="nodeEdit( vright.right_id )" title="编辑权限信息">
                                <i class="edit icon"></i>编辑
                            </a>&nbsp;
                            <a href="javascript:;"  ng-click="nodeDel( vright )" title="删除权限">
                                <i class="remove icon"></i>删除
                            </a>
                        </td>
                    </tr>
                    <tr ng-show="(rightspage && rightspage.length == 0) ||(!rightspage)">
                        <td colspan="6">
                            <p class="ui center aligned  header">{{'NO_DATA' | translate}}</p>
                        </td>
                    </tr>
                </tbody>
            </table>
            <div ng-show="rightspage.pageAll > 1" class="ui borderless pagination menu" jspagination   page-object="rightspage" page-func="getDataList" ></div>
        </div>
	</div>

    <div class="ui rights add modal">
        <i class="close icon"></i>
        <div class="header_h4">
            添加权限
        </div>
        <div class="content">
            <form action="#" name="frm-add" id="frm-add" style="width:94%;margin-left:3%;">
                <div class="ui form">
                        <div class="inline field required">
                            <label class="two wide field">权限名称</label>
                            <input type="text" name="add[right_name]" ng-model="add_data.right_name" placeholder="请输入权限名称">
                        </div>
                        <div class="inline field required">
                            <label class="two wide field">权限代码</label>
                            <input type="text" name="add[code]" ng-model="add_data.code" placeholder="权限代码">
                        </div>
                        <div class="ui row">
                            <label class="two wide field">绑定权限</label>
                            <div class="ui top attached tabular menu">
                              <a class="item active" data-tab="comm" ng-click="tab('comm')">常用权限</a>
                              <a class="item" data-tab="{{k}}"  ng-click="tab(k)" ng-repeat="(k,v) in rightcfgs.config">{{v.name}}</a>
                            </div>
                            <div class="ui bottom attached tab segment active" data-tab="comm">
                                <label class="checkbox-inline" ng-repeat="v in rightcfgs.common.CMM.child">
                                    <input type="checkbox" name="edit[rights][CMM][]" checked="checked" data-value="{{v.code}}"  >{{v.name}}
                                </label>
                            </div>
                            <div class="ui bottom attached tab segment" data-tab="{{k}}" ng-repeat="(k,v) in rightcfgs.config" >
                            <label class="checkbox-inline" ng-repeat="vnode in v.child">
                                    <input type="checkbox" name="edit[rights][{{k}}][]"  class="addchk" ng-click="addchk(k,vnode )" data-value="{{vnode.code}}"  >{{vnode.name}}
                                </label>
                            </div>
                        </div>

                        <div class="inline field">
                            <label class="two wide field">权限备注信息</label>
                            <input type="text" name="add[info]"  ng-model="add_data.info" class="seven wide field" placeholder="权限信息备注">
                        </div>
                </div>
            </form>
        </div>
        <div class="actions">
            <button class="ui green button positive">{{'BTN_OK' | translate}}</button>
            <button class="ui grey button negative">{{'BTN_CANCEL' | translate}}</button>
        </div>
    </div>

<div class="ui rights edit modal">
    <i class="close icon"></i>
    <div class="header_h4">
        修改权限信息
    </div>
    <div class="content">
        <form action="#" name="frm-edit" id="frm-edit" style="width:94%;margin-left:3%;">
                <div class="ui form">
                        <div class="inline field required">
                            <label class="two wide field">权限名称</label>
                            <input type="text" name="edit[right_name]" ng-model="edit_data.right_name" placeholder="请输入权限名称">
                        </div>
                        <div class="inline field required">
                            <label class="two wide field">权限代码</label>
                            <input type="text" name="add[code]" ng-model="edit_data.code" placeholder="权限代码">
                        </div>
                        <div class="ui row">
                            <label class="two wide field">绑定权限</label>
                            <div class="ui top attached tabular menu">
                              <a class="item active" data-tab="comm" ng-click="tab('comm')">常用权限</a>
                              <a class="item" data-tab="{{k}}"  ng-click="tab(k)" ng-repeat="(k,v) in rightcfgs.config">{{v.name}}</a>
                            </div>
                            <div class="ui bottom attached tab segment active" data-tab="comm">
                                <label class="checkbox-inline" ng-repeat="v in rightcfgs.common.CMM.child">
                                    <input type="checkbox" name="edit[rights][CMM][]" checked="checked" data-value="{{v.code}}"  >{{v.name}}
                                </label>
                            </div>
                            <div class="ui bottom attached tab segment" data-tab="{{k}}" ng-repeat="(k,v) in rightcfgs.config" >
                            <label class="checkbox-inline" ng-repeat="vnode in v.child">
                                    <input type="checkbox" name="edit[rights][{{k}}][]"  class="editchk" ng-click="editchk(k,vnode )"
                                     value="{{vnode.code}}"  >{{vnode.name}}
                                </label>
                            </div>
                        </div>
                        <div class="inline field">
                            <label class="two wide field">权限备注信息</label>
                            <input type="text" name="edit[info]"  ng-model="edit_data.info" class="seven wide field" placeholder="权限信息备注">
                        </div>
                </div>
            </form>
    </div>
    <div class="actions">
        <button class="ui green button positive">{{'BTN_OK' | translate}}</button>
        <button class="ui grey button negative">{{'BTN_CANCEL' | translate}}</button>
    </div>
</div>
<script type="text/javascript">
    $(function(){
        $('.ui.dropdown').dropdown();
        $('.ui.radio.checkbox').checkbox();
        $('#frm-add').form({
            inline:true,
            on: 'blur',
            fields: {
                right_name: {
                    identifier: 'add[right_name]',
                    rules: [
                      {
                        type   : 'empty',
                        prompt : '权限名称不能为空'
                      }
                    ]},
                code:{
                    identifier: 'add[code]',
                    rules: [
                      {
                        type:'empty',
                        prompt:'权限代码简称不能为空'
                      }
                    ]}
                 }
        });

        $('#frm-edit').form({
            inline:true,
            on: 'blur',
            fields: {
              right_name: {
                identifier: 'edit[right_name]',
                rules: [
                  {
                    type   : 'empty',
                    prompt : '权限名称不能为空'
                  }
                ]},
                code:{
                identifier: 'edit[code]',
                rules: [
                  {
                    type:'empty',
                    prompt:'权限代码简称不能为空'
                  }
                ]},
            }
        });
    });
</script>